<?php

use yii\db\Migration;

class m200103_022103_Information extends Migration
{
    public function up()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="资讯表"';
        $this->createTable('{{%information}}', [
            'id' => $this->primaryKey(),
            'title' => $this->string()->notNull()->comment('标题'),
            'pic' => $this->string()->notNull()->comment('缩略图'),
            'section' => $this->smallInteger()->notNull()->comment('栏目 1行业新闻 2企业公告'),
            'simple' => $this->string()->notNull()->defaultValue('')->comment('简介'),
            'intro' => $this->string()->notNull()->defaultValue('')->comment('内容'),
            'status' => $this->smallInteger()->notNull()->defaultValue(1)->comment('状态：为1正常，2为删除'),
            'sorts' => $this->integer()->defaultValue(50)->comment('排序'),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),
            'deleted_at' => $this->integer(),
        ],$tableOptions);
    }

    public function down()
    {
        $this->dropTable('{{%information}}');
        return false;
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
